var path = require("path");

//将路径或路径片段解析为绝对路径
var result = path.resolve("/foo/bar", "./baz");
console.log(result);

var result = path.resolve("/foo/bar", "../baz");
console.log(result);

//判断一个路径是否为绝对路径，返回值为true/false
var result = path.isAbsolute("D:/桌面/千峰培训学习2110/第三阶段/node/data/1.txt")
console.log(result);
var result = path.isAbsolute("../data/1.txt")
console.log(result);

//根据当前工作目录返回从 from 到 to 的相对路径
var result = path.relative('/data/orandea/test/aaa')